# coding: utf-8
from qfluentwidgets import BodyLabel, MessageBoxBase, setFont

from components.widgets import VerticalScrollArea


class ScrollAreaMessageBox(MessageBoxBase):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.scrollArea = VerticalScrollArea(self)
        self.titleLabel = BodyLabel('标题', self)

        setFont(self.titleLabel, 20)
        # 初始化控件布局
        self._hBoxLayout.removeWidget(self.widget)
        self._hBoxLayout.setContentsMargins(100, 50, 100, 50)
        self._hBoxLayout.addWidget(self.widget, 1)

        self.viewLayout.addWidget(self.scrollArea, 1)
        self.scrollArea.addWidget(self.titleLabel)
        self.scrollArea.addSpacing(20)
        # self.setClosableOnMaskClicked(True)
        # self.setDraggable(True)

    def setTitle(self, title: str):
        self.titleLabel.setText(title)
